import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class Main {
    public static void main(String[] args) {

        String s="aza";
        String t="abzba";
        Main m=new Main();
        System.out.println(m.isSubsequence(s,t));
    }
    //最后一个单词的长度
    public int lengthOfLastWord(String s) {
        int n=s.length();
        int i=n-1;
        int count=0;
        //先找到最后一个单词
        while(i>=0&&s.charAt(i)==' '){
            i--;
        }
        while(i>=0&&s.charAt(i)!=' '){
            count++;
            i--;
        }
        return count;
    }


    public boolean isSubsequence(String s, String t) {
        int n = s.length(), m = t.length();
        int i = 0, j = 0;
        while (i < n && j < m) {
            if (s.charAt(i) == t.charAt(j)) {
                i++;
            }
            j++;
        }
        return i == n;
    }
}